import { post, get } from './http'
// import qs from 'qs'
// import axios from 'axios'

// 登录
export const Login = params => post('/Login/login', params)
// 注册
export const Register = params => post('/User/addUser', params)

// 查询所有图书
export const getBooks = () => get('/Book/books')
// 添加图书
export const addBook = (params, config) => post('/Book/addBook', params, config)
// 上传图片
export const uploadImage = params => post('/Book/img', params, {
  headers: {
    'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
  }
})
// 编辑图书
export const updateBook = params => post('/Book/updateBook', params)

// 删除图书
export const deleteBook = params => post(`/Book/deleteBook?xpk_1913040735_bookId=${params}`)

// 获取图书类别
export const getBookTypes = () => get('/BookType/BookTypes')
// 添加书籍类别
export const addBookType = params => post('/BookType/addBookType', params)
// 删除书籍类别
export const deleteBookType = id => post(`/BookType/deleteBookType?bookTypeId=${id}`)

// 查询所有用户
export const getUsers = () => get('/User/users')
// 注销用户
export const deleteUser = id => post(`/User/deleteUser?userId=${id}`)
// 修改用户权限
export const updateUserType = id => post(`/User/updateUserType?userId=${id}`)
